package com.rory.gooday.life;

import com.jfinal.aop.Inject;
import com.jfinal.core.Controller;
import com.jfinal.core.Path;
import com.rory.gooday.common.R;
import com.rory.gooday.common.model.Life;
import com.rory.gooday.common.model.Memorial;

import java.util.List;

@Path("/life")
public class LifeController extends Controller {
	
	@Inject
	LifeService service;
	
	public void index() {
		render("life.html");
	}

	public void data() {
		List<Life> list =  service.list();
		renderJson(R.ok(list));
	}
	
	public void add() {
	}

	public void save() {
	}
	
	public void edit() {
		Life a = service.findById(getParaToInt());
		setAttr("life", a);
	}

	public void update() {
        Life a = getBean(Life.class);
		renderJson(R.ok(1));
	}
	
	public void delete() {
		service.deleteById(getParaToInt());
		redirect("/memorial");
	}
}


